import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const store = new Vuex.Store({
	state: {
		/**
		 * 是否需要强制登录
		 */
		forcedLogin: true,
		hasLogin: uni.getStorageSync("HasLogin"),
		auth_token: ""
	},
	mutations: {
		login(state, auth_token) {
			state.auth_token = uni.getStorageSync("auth_token");
			state.hasLogin = true;
		},
		logout(state) {
			state.auth_token = "";
			state.hasLogin = uni.getStorageSync("HasLogin");
		}
	}
})

export default store
